import requests

# 定义请求的URL
url = "https://push2his.eastmoney.com/api/qt/stock/kline/get"

# 定义请求参数
params = {
    "cb": "jQuery3510370131313223296294_1715487041750",
    "secid": "0.300215",
    "ut": "fa5fd1943c7b386f172d6893dbfba10b",
    "fields1": "f1,f2,f3,f4,f5,f6",
    "fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f60,f61",
    "klt": "101",
    "fqt": "1",
    "beg": "0",
    "end": "20500101",
    "smplmt": "460",
    "lmt": "10000000",
    "_": "1715487041751"
}

# 定义请求头，注意替换YOUR_COOKIE_VALUE为实际的Cookie值
headers = {
    "Accept": "*/*",
    "Accept-Encoding": "gzip, deflate, br, zstd",
    "Accept-Language": "zh-CN,zh;q=0.9",
    "Connection": "keep-alive",
    "Cookie": "EMFUND1=null; EMFUND2=null; EMFUND3=null; qgqp_b_id=68b63807cae5eae733d7117bb169f23e; mtp=1; st_si=18188094520107; EMFUND0=null; EMFUND5=04-10%2018%3A03%3A33@%23%24%u540C%u6CF0%u6052%u5229%u7EAF%u503AC@%23%24008729; EMFUND6=04-10%2017%3A24%3A14@%23%24%u6469%u6839%u963F%u5C14%u6CD5%u6DF7%u5408A@%23%24377010; EMFUND7=05-03%2016%3A31%3A30@%23%24%u91D1%u9E70%u6DFB%u76C8%u7EAF%u503A%u503A%u5238C@%23%24012623; testtc=0.32194803602775246; EMFUND8=05-04%2009%3A28%3A53@%23%24%u5E7F%u53D1%u5168%u7403%u79D1%u6280%u4E09%u4E2A%u6708%u5B9A%u5F00%u6DF7%u5408%28QDII%29%u4EBA%u6C11%u5E01C@%23%24011422; EMFUND4=05-04%2009%3A28%3A54@%23%24%u91D1%u9E70%u6DFB%u76C8%u7EAF%u503A%u503A%u5238A@%23%24003384; EMFUND9=05-10 18:09:40@#$%u5E7F%u53D1%u5168%u7403%u79D1%u6280%u4E09%u4E2A%u6708%u5B9A%u5F00%u6DF7%u5408%28QDII%29%u4EBA%u6C11%u5E01A@%23%24011420; websitepoptg_api_time=1715466708966; ct=n7kS5XRrcKUts_355ynMMs0yq_e4rc4OXaedJZMuHoISUU0Wynusf0AgPAkkFBBucvffg6wETOQ217Y7ryts5bKG8N8UXBpzH9VL9c21zJY2PvB5a0BueKy-xJGN5Dd2WUhg5nF0Kl-XsWjiWEYLeZLpnKAUmgZVT-taFf00oso; ut=FobyicMgeV6Gl5Ws0rOH5vgCxof8z-Vx7TcwbaHS52c5GlBfzK-YebDYQqv4IHXpMyF1JNlXEACp_jb087ftsi900uHO3u0UgCqdghrBHj4vmjREPeV4y4Eo7AkDlYY5OYSEH3lm05dxPsUMXuNCmq0KEtnFX21LW2E2Vl1gx0E2A9aNuMdxWSp1qjgouXkvxc1vmThqj9dSGl0aJ1Ib1m6wx4gq3xsi2loKvmwsTR4mxoI72u7uY-w-mmS9tb27ZaIwusSzHQxMgEmKitKqChs_RUWOxBEN; sid=118300771; pi=6364113877216764%3B%3B%E9%9D%9C%E6%B8%81%E8%93%85%E5%A0%94%3Bob5z7alAmhOcAk1AQaemWPDFSv4q%2BFuGhI0uVkQpllqq%2BUFUREQcvb1ARsAgn2lh7p5WveZtt%2BgccgTZXL%2BM0eGOnmQotarYmEzyEnPByojwPYl%2F9o%2Bs2O54aJI7jkSJqhasRlNdP6o9r8s7drwPqPlBtdD1%2BDGF%2BVVm%2BmLdnQ6%2FtefmGaaXTLMucU4X%2Bio02wHeOTJ%2F%3BzKAfkWLPkp6Km8AaJSb5fUZNVuf2vgL%2B5JqIN1EpsxVcG1fnttN6dwo%2FeXegOA8QMmlhf4ZlbZemOyWtGz%2BWKrS47gKuQ3Cn1Wdxo8HNQz2yxkC%2Bcl6AVOUUiycScYYRrluqNGFlUifycO8HwobbEpGi5lSogA%3D%3D; uidal=6364113877216764%e9%9d%9c%e6%b8%81%e8%93%85%e5%a0%94; vtpst=%7c; st_asi=delete; HAList=ty-0-300215-%u7535%u79D1%u9662%2Cty-0-300059-%u4E1C%u65B9%u8D22%u5BCC; st_pvi=97247613210367; st_sp=2024-04-10%2013%3A06%3A08; st_inirUrl=https%3A%2F%2Ffund.eastmoney.com%2F003384.html; st_sn=302; st_psi=20240512122250189-113200301201-6222666538",
    "Host": "push2his.eastmoney.com",
    "Referer": "https://quote.eastmoney.com/sz300215.html",
    "Sec-Ch-Ua": "\"Chromium\";v=\"124\", \"Google Chrome\";v=\"124\", \"Not-A.Brand\";v=\"99\"",
    "Sec-Ch-Ua-Mobile": "?0",
    "Sec-Ch-Ua-Platform": "\"Windows\"",
    "Sec-Fetch-Dest": "script",
    "Sec-Fetch-Mode": "no-cors",
    "Sec-Fetch-Site": "same-site",
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0 Safari/537.36"}

# 发起GET请求
response = requests.get(url, params=params, headers=headers)

# 检查响应状态码
if response.status_code == 200:
    print("请求成功")
    # 处理响应数据
    print(response.text)
else:
    print(f"请求失败，状态码：{response.status_code}")